package com.xiangyang.controller;
import com.xiangyang.entity.PatientInformation;
import com.xiangyang.entity.Prescription;
import com.xiangyang.entity.dto.Result;
import com.xiangyang.service.IRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/PatientDetails")
@CrossOrigin
public class PatientDetailsController {
     @Autowired
    private IRegistrationService registrationService;
     @PostMapping("/addPatients")
    public Result addPatients(@RequestBody PatientInformation patientInformation){
         System.out.println(patientInformation);
         return registrationService.addPatientDetails(patientInformation);}
    @PostMapping("/updatePatients")
    public Result updatePatients(@RequestBody PatientInformation patientInformation){return registrationService.updatePatientDetails(patientInformation);}//修改挂号信息
    @PostMapping("/getPatients")
    private Result PatientInformationController(){
        return registrationService.getPatientDetailsById();
    }//获取所有患者信息
    @GetMapping ("/getPatientsById")
    private Result getPatientDetailsById(String PatientName, String PatientPhone){
         return registrationService.getPatientDetailsById(PatientName, PatientPhone);
     }//获取患者名字和电话查询获取患者信息
}
